#include <stdio.h>      // 标准输入输出
#include <unistd.h>     // POSIX标准接口
#include <stdlib.h>
#include <stdbool.h>

#include "ohos_init.h"
#include "cmsis_os2.h"

#include "iot_gpio.h"
#include "hi_io.h"
#include "hi_adc.h"

#define FIRE_SENSOR_CHAN_NAME HI_ADC_CHANNEL_5    //gpio11


void Fire ()
{
    IotGpioValue value;
    IoTGpioInit(FIRE_SENSOR_CHAN_NAME);
    hi_io_set_func(FIRE_SENSOR_CHAN_NAME,HI_IO_FUNC_GPIO_11_GPIO);
    IoTGpioSetDir(FIRE_SENSOR_CHAN_NAME,IOT_GPIO_DIR_IN);
    IoTGpioGetInputVal(FIRE_SENSOR_CHAN_NAME,&value);
    if (value == IOT_GPIO_VALUE0)
    {
        printf("火焰报警");
    }
    else if(value == IOT_GPIO_VALUE1)
    {
        printf("无火焰");
    }
}